package cn.edu.scau.cmi.wuzewei.comprehensive;

import cn.edu.scau.cmi.wuzewei.interProgramming.GraduateStudent;
import cn.edu.scau.cmi.wuzewei.interProgramming.Student;
import cn.edu.scau.cmi.wuzewei.interProgramming.UndergraduateStudent;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;

public class InterProgrammingWindow {
	public void newWindow(Stage primaryStage) {

		Group group = new Group();

		Student graduateStudent = new GraduateStudent();
		Student undergraduateStudent = new UndergraduateStudent();

		TextArea textArea = new TextArea();
		textArea.setLayoutX(70);
		textArea.setLayoutY(120);
		group.getChildren().add(textArea);

		Button btn1 = new Button("未毕业生");
		btn1.setLayoutX(80);
		btn1.setLayoutY(80);
		btn1.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				textArea.setText(undergraduateStudent.learning());
			}
		});
		group.getChildren().add(btn1);

		Button btn2 = new Button("毕业生");
		btn2.setLayoutX(160);
		btn2.setLayoutY(80);
		btn2.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				textArea.setText(graduateStudent.learning());
			}
		});
		group.getChildren().add(btn2);

		Scene scene = new Scene(group);
		primaryStage.setTitle("实验一：接口编程");
		primaryStage.setWidth(600);
		primaryStage.setHeight(400);
		primaryStage.setScene(scene);
		primaryStage.show();
	}
}
